/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package view;

import interfaces.VareInterface;
import interfaces.VareSalgInterface;
import java.rmi.RemoteException;
import javax.swing.JOptionPane;
import utility.PriceFormater;

/**
 *
 * @author Jeppe
 */
public class VareKurvPanel extends javax.swing.JPanel {

    private final VareSalgInterface vareSalgInterface;
    private VareBestillingsPanel varebestillingspanel;

    /**
     * Creates new form VarePanel
     * @param lager_VareInterface
     */
    public VareKurvPanel(VareSalgInterface vareSalg, VareBestillingsPanel varebestillingsPanel) {
        initComponents();
        vareSalgInterface = vareSalg;
        this.varebestillingspanel = varebestillingsPanel;
        try {            
            titelLabel.setText(vareSalg.getVare().getTitel());
            antalLabel.setText(vareSalg.getAntal()+"");
            prisLabel.setText(PriceFormater.formaterPrisTilString(vareSalg.getSalgsPris()*vareSalg.getAntal()));
        } catch (RemoteException ex) {
            JOptionPane.showMessageDialog(this, "Der er opstået en fejl på forbindelsen mod serveren", "Remote-Exception", 0);
        }
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        titelLabel = new javax.swing.JLabel();
        antalLabel = new javax.swing.JLabel();
        prisLabel = new javax.swing.JLabel();

        setBorder(javax.swing.BorderFactory.createEtchedBorder());
        setLayout(null);

        titelLabel.setText("varetitel");
        add(titelLabel);
        titelLabel.setBounds(10, 11, 90, 14);

        antalLabel.setText("antal");
        add(antalLabel);
        antalLabel.setBounds(110, 10, 60, 14);

        prisLabel.setText("pris");
        add(prisLabel);
        prisLabel.setBounds(190, 10, 80, 14);
    }// </editor-fold>//GEN-END:initComponents


    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel antalLabel;
    private javax.swing.JLabel prisLabel;
    private javax.swing.JLabel titelLabel;
    // End of variables declaration//GEN-END:variables
}
